package st.business.tepth.business.businfo;

import st.business.tepth.base.OnDataConvertListener;
import st.business.tepth.business.bean.BusDriverInfoBean;

/**
 * Author: shadow
 * Email:  1025431817@qq.com
 * Time:   2019-02-27 10:33
 */

public class BusInfoPresenter extends BusInfoContract.Presenter {
    private final BusInfoContract.View mView;
    private final BusInfoContract.Model mModel;

    public BusInfoPresenter(BusInfoContract.View view) {
        mView = view;
        mModel = new BusInfoModel();
    }

    @Override
    void getBusInfo(String token, int repairId) {
        addDisposable(mModel.getBusInfo(token, repairId,
                new OnDataConvertListener<BusDriverInfoBean>() {
                    @Override
                    public void convert(BusDriverInfoBean busDriverInfoBean) {
                        mView.showData(busDriverInfoBean);
                    }

                    @Override
                    public void error(int code, String msg) {
                        mView.showError(msg);
                    }
                }));
    }
}
